package tester;

import tester.ui.MainForm;

import javax.swing.*;
import java.util.List;
import java.util.ArrayList;
import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: aleck
 * Date: 2007-9-23
 * Time: 22:41:37
 * To change this template use File | Settings | File Templates.
 */
public class MyUIManager {
  private static List<Component> list = new ArrayList<Component>();
  private static MainForm mainForm = null;

  public static void addComponent(Component component) {
    list.add(component);
  }

  public static void removeComponent(Component component) {
    list.remove(component);
  }

  public static void setTitle(String title) {
    if (mainForm != null) {
      mainForm.setTitle(title);
    }
  }

  public static void removeAll() {
    list.removeAll(list);
  }

  public static void repaintAll() {
    for (Component component : list) {
      component.repaint();
    }
  }

  public static void updateMainTableFocus(Person person, Problem problem) {
    if (mainForm != null) {
      mainForm.updateTableFocus(person, problem);
    }
  }

  public static void setMainForm(MainForm mainForm) {
    MyUIManager.mainForm = mainForm;
  }

}
